package com.controller.Exception;

import com.domain.Result;
import com.statics.Code;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class ProjectException {

    @ExceptionHandler(SystemException.class)
     public Result systemException(SystemException ex){

        return new Result(ex.getCode(),null,ex.getMessage());
     }

    @ExceptionHandler(BusinessException.class)
    public Result businessException(BusinessException ex){

        return new Result(ex.getCode(),null,ex.getMessage());
    }


     @ExceptionHandler(Exception.class)
    public Result doExpection(Exception ex){

         return new Result(Code.SYSTEM_UNKOWN,null,"异常报错");
    }
}
